<template>
  <div class="dashboard-container">
    <div class="app-container">
      <el-card shadow="never" >
        <!-- 表单 -->
        <!-- 子传父表单传父组件 -->
        <questionsForm @form="form" @counts="counts"></questionsForm>
        <!-- 表格 -->
        <!-- 父传表格子组件-->
        <questionsTable :resData.sync="res" :formData.sync="formData" :counts="allCounts"></questionsTable>

      </el-card>
    </div>
  </div>
</template>

<script>
// 导入表单组件
import questionsForm from '@/module-hmmm/components/questions-form.vue'
// 导入表格组件
import questionsTable from '@/module-hmmm/components/questions-table.vue'
export default {
// 注册组件
  components: {
    questionsForm,
    questionsTable
  },
  data () {
    return {
      // 表单搜索的数据
      res: [],
      //  表单填的值传过来
      formData: {},
      allCounts: null // total需要Number，你默认给的"",给null就好了忘了 不知道当时咋想的 整了2小时 我又累了哈哈哈哈睡吧  我要看电视了
    }
  },
  methods: {
    form (val1, val2) {
      // console.log(val1, val2, '传值')
      this.res = val1
      this.formData = val2
    },
    counts (val) {
      this.allCounts = val
      // console.log(this.allCounts, '条数传值')
    }
  },
  // 侦听总条
  watch: {
    allCounts: {
      deep: true,
      handler () {

      }
    }
  }
}
</script>

<style scoped></style>
